from Page.Page_product import Page_product
from selenium.webdriver.common.by import By


class Page_product_operation(Page_product):
    navtab = (By.LINK_TEXT, '设置支付方式')
    add_zf = (By.XPATH, '//*[@id="navTab"]/div[2]/div[3]/div[2]/div[1]/ul/li[1]/a')
    payRate = (By.NAME, 'payRate')
    ajaxTodo = (By.XPATH, '//*[@id="navTab"]/div[2]/div[2]/div[2]/div[2]/div[2]/div/table/tbody/tr[1]/td[6]/div/a[2]?')
    shangjia = (By.LINK_TEXT, '上架')
    submit=(By.XPATH,'//*[@id="navTab"]/div[2]/div[4]/div/form/div[2]/ul/li[1]/div/div/button')
    cp = (By.XPATH, '/html/body/div[1]/div[3]/div/div[1]/div[1]/ul/li[2]/a[1]')
    qd=(By.XPATH,'/html/body/div[13]/div[1]/div/div[2]/ul/li[1]/a/span')
    qx = (By.XPATH, '//*[@id="alertMsgBox"]/div[1]/div/div[2]/ul/li[2]/a')
    text = (By.XPATH, '//*[@id="alertMsgBox"]/div[1]/div/div[1]/div')

    def click_nav(self):
        self.click(self.navtab)

    def click_add_zf(self):
        self.click(self.add_zf)

    def send_pay(self, info):
        self.send_keys(self.payRate, info)


    def click_cp(self):
        self.click(self.cp)

    def shang_click(self):
        self.click(self.shangjia)
    def click_submit(self):
        self.click(self.submit)
    def click_qd(self):
        self.click(self.qd)


    def test_get(self):
        return self.get_element_text(self.text)

    def quxiao(self):
        self.click(self.qx)
    def zt_text(self):
        return self.get_element_text(self.navtab)